How to implement stack using arrays in C